package com.itheima.dao;

import com.itheima.pojo.User;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import javax.sql.DataSource;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-06 10:21
 * @description
 *
 * 这今天  咱们不管跟mybatis如何集成
 */
//@Component
@Repository
public class UserDao {
    //肯定需要连接池!!!
    private DataSource dataSource;

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    public User findUserByUsernameAndPassword(String username, String password){
        //这是模拟 咱们今天不真正连接数据库!

        System.out.println("从连接池获取连接");
        System.out.println("执行sql语句");
        System.out.println("关闭连接.......");
        return new User();
    }
}
